{% extends "master.html" %}
{% block subtitle %} - 报表 - {{label}}{% endblock %}


{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="{{url_for('bpRpt.view')}}">报表</a></li>
          <li class="active">{{label}}</li>
        </ol>
    </div>
    
    <div class="row">
        <div class="panel panel-primary">
            <div class="panel-heading"><h4 class="panel-title">输入查询条件</h4></div>
            <div class="panel-body">
                <div class="row">
                    <form class="" method='POST' action="{{url_for('bpRpt.view',action='export')}}">
                        <input type="hidden" name='t' value="{{t}}"/>
                        {{render_shop_field()}}
                    
                        {% if t == 'sale' %}
                            {{render_date_fields()}}
                        {% elif t == 'prh' %}
                            {{render_date_fields()}}        
                        {% elif t == 'ivt' %}
                            
                        {% elif t == 'ivtnt' %}
                            {{render_date_fields()}}
                        {% elif t == 'fin' %}
                            {{render_date_fields()}}      
                        {% endif %}
                    </form>
                </div>                
                <div class="row">
                    <div class="col-md-12">
                    <div class="btn-toolbar pull-right">
                        <div class="btn-group"><button type="button" class="btn btn-primary" onclick="$('form').submit()">{{BTN_EXPORT_RPT}}</button></div>
                    </div>
                    </div>
                </div>
            </div>    
        </div>
    </div>
</div>
{% endblock %}


{% macro render_shop_field() -%} 
    {% if getAllPermission(['SHOP_VIEW_ALL']) %}    
        <span class="col-md-3">
            <div class="control-group controls-row">
                <label class="control-label" for="createTimeFrom"><label for="createTimeFrom">店铺</label></label>
                <div class="controls">
                    {{mymacros.select('shopID',shops,class='form-control')}}
                </div>
            </div>
        </span>
    {% endif %}
{%- endmacro %}

{% macro render_date_fields() -%} 
    <span class="col-md-3">
        <div class="control-group controls-row">
            <label class="control-label" for="createTimeFrom"><label for="createTimeFrom">创建时间(开始)</label></label>
            <div class="controls"><input class="datepicker form-control" id="createTimeFrom" name="createTimeFrom" type="text" value=""></div>
        </div>
    </span>
    <span class="col-md-3">
        <div class="control-group controls-row">
            <label class="control-label" for="createTimeTo"><label for="createTimeTo">创建时间(结束)</label></label>
            <div class="controls"><input class="datepicker form-control" id="createTimeTo" name="createTimeTo" type="text" value=""></div>
        </div>
    </span>
{%- endmacro %}